<!DOCTYPE html>
<html
  lang="zh"
  xmlns:th="http://www.thymeleaf.org"
  xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
>
  <head>
    <th:block th:include="include :: header('党员信息列表')" />
  </head>
  <body class="gray-bg">
    <div class="container-div">
      <div class="row">
        <div class="col-sm-12 search-collapse">
          <form id="formId">
            <div class="select-list">
              <ul>
                <li>
                  <label>党员编号：</label>
                  <input type="text" name="partyNo" />
                </li>
                <li>
                  <label>姓名：</label>
                  <input type="text" name="name" />
                </li>
                <li>
                  <label>政治面貌：</label>
                  <select name="politicalStatus">
                    <option value="">所有</option>
                    <option value="中共党员">中共党员</option>
                    <option value="预备党员">预备党员</option>
                  </select>
                </li>
                <li>
                  <label>状态：</label>
                  <select
                    name="status"
                    th:with="type=${@dict.getType('party_member_status')}"
                  >
                    <option value="">所有</option>
                    <option
                      th:each="dict : ${type}"
                      th:text="${dict.dictLabel}"
                      th:value="${dict.dictValue}"
                    ></option>
                  </select>
                </li>
                <li>
                  <a
                    class="btn btn-primary btn-rounded btn-sm"
                    onclick="$.table.search()"
                    ><i class="fa fa-search"></i>&nbsp;搜索</a
                  >
                  <a
                    class="btn btn-warning btn-rounded btn-sm"
                    onclick="$.form.reset()"
                    ><i class="fa fa-refresh"></i>&nbsp;重置</a
                  >
                </li>
              </ul>
            </div>
          </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
          <a
            class="btn btn-success"
            onclick="$.operate.add()"
            shiro:hasPermission="system:partymember:member:add"
          >
            <i class="fa fa-plus"></i> 新增党员
          </a>
        </div>

        <div class="col-sm-12 select-table table-striped">
          <table id="bootstrap-table"></table>
        </div>
      </div>
    </div>

    <th:block th:include="include :: footer" />

    <script th:inline="javascript">
      var editFlag = [[${@permission.hasPermi('system:partymember:member:edit')}]];
      var prefix = ctx + "system/partymember/member";

      $(function() {
      	var options = {
      		url: prefix + "/list",
      		createUrl: prefix + "/add",
      		updateUrl: prefix + "/edit/{id}",
      		viewUrl: prefix + "/view/{id}",
      		removeUrl: prefix + "/remove",
      		exportUrl: prefix + "/export",
      		modalName: "党员信息",
      		search: true,
      		showSearch: true,
      		showExport: true,
      		columns: [{
      			checkbox: true
      		},
      		{
      			field: 'id',
      			title: '主键'
      		},
      		{
      			field: 'partyNo',
      			title: '党员编号',
      			align: 'center'
      		},
      		{
      			field: 'name',
      			title: '姓名',
      			align: 'center'
      		},
      		{
      			field: 'gender',
      			title: '性别',
      			align: 'center',
      			formatter: function(value, row, index) {
      				if (value == '0') {
      					return '男';
      				} else if (value == '1') {
      					return '女';
      				} else {
      					return value;
      				}
      			}
      		},
      		{
      			field: 'birthDate',
      			title: '出生日期',
      			align: 'center'
      		},
      		{
      			field: 'politicalStatus',
      			title: '政治面貌',
      			align: 'center'
      		},
      		{
      			field: 'joinPartyDate',
      			title: '入党日期',
      			align: 'center'
      		},
      		{
      			field: 'deptId',
      			title: '所属部门ID',
      			align: 'center'
      		},
      		{
      			field: 'identityType',
      			title: '身份类型',
      			align: 'center',
      			formatter: function(value, row, index) {
      				if (value == '1') {
      					return '教师';
      				} else if (value == '2') {
      					return '学生';
      				} else if (value == '3') {
      					return '职工';
      				} else {
      					return value;
      				}
      			}
      		},
      		{
      			field: 'status',
      			title: '状态',
      			align: 'center',
      			formatter: function(value, row, index) {
      				if (value == '0') {
      					return '<span class="label label-primary">正常</span>';
      				} else if (value == '1') {
      					return '<span class="label label-warning">转出</span>';
      				} else if (value == '2') {
      					return '<span class="label label-info">休学</span>';
      				} else if (value == '3') {
      					return '<span class="label label-default">退休</span>';
      				} else {
      					return value;
      				}
      			}
      		},
      		{
      			field: 'isExcellent',
      			title: '是否是优秀党员',
      			align: 'center',
      			formatter: function(value, row, index) {
      				if (value == '1') {
      					return '<span class="label label-success">是</span>';
      				} else {
      					return '<span class="label label-default">否</span>';
      				}
      			}
      		},
      		{
      			field: 'createTime',
      			title: '创建时间',
      			align: 'center'
      		},
      		{
      			title: '操作',
      			align: 'center',
      			formatter: function(value, row, index) {
      				var actions = [];
      				actions.push('<a class="btn btn-info btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.view(\'' + row.id + '\')" shiro:hasPermission="system:partymember:member:view"><i class="fa fa-eye"></i> 查看</a> ');
      				actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i> 编辑</a> ');
      				actions.push('<a class="btn btn-danger btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-trash"></i> 删除</a>');
      				return actions.join('');
      			}
      		}]
      	};
      	$.table.init(options);
      });
    </script>
  </body>
</html>
